<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<c:set var="reportTitle" value="halm机测试 - 颜色比例图表" scope="session"/>

<%@ include file="/common/report_head.jsp"%>
<%@ include file="/condition/sartTime_YMDH_input.html"%>
<%@ include file="/condition/endTime_YMDH_input.html"%>
<%@ include file="/condition/fab_sumo_must.html"%>
<%@ include file="/condition/effNo_sumo.html"%>
<%@ include file="/condition/line_sumo.html"%>
<%@ include file="/condition/toolg_sumo.html"%>
<%@ include file="/condition/toolType_radio.html"%>
<%@ include file="/condition/tool_sumo.html"%>
<%@ include file="/condition/spec_sumo.html"%>
<%@ include file="/condition/waferSpec_sumo.html"%>
<%@ include file="/condition/manufacturer_sumo.html"%>
<%@ include file="/condition/baseIdsumo.html"%>
<%--<%@ include file="/condition/attributes_sumo.html"%>--%>
<%--<%@ include file="/condition/gear_sumo.html"%>--%>
<%@ include file="/condition/lotId_text.html"%>
<%@ include file="/condition/groupBy3_radio.html"%>
<%@ include file="/condition/gear_sumo.html"%>

<%@ include file="/common/report_middle.jsp" %>
<%@ include file="/charts-grid/echarts2.html"%>
<div class="col-md-12" style="height: 420px;">
    <div id="pqGrid"></div>
</div>
<%@include file="/common/report_end.jsp" %>


<script>
    $(document).ready(function () {
        $("title").text("halm机测试 - 颜色比例图表");
        $("label:contains('线别:')").addClass("keyCss");

        $('#query_btn').click(function (){
            if($("#bayIdSumo").val() === null || $("#bayIdSumo").val() === '' ) { showErrorDialog("0000002", "线别为必选项"); return false; }
            initGridAndChart();
            ajax('/jn-report/report/halm_colorScale_report.do' ,loadConditionMapData(), true, ajax_successful);

            function ajax_successful(outTrxObj) {
                if(outTrxObj.gridData.length < 1) { showMessengerDialog("数据查询为空"); return false; }

                //Chart图数据赋值
                if ($("#charts").length > 0) {
                    var echartsData = outTrxObj.chartsData;
                    option.backgroundColor = 'white';
                    option.grid.show = false;
                    option.title.text = echartsData.title;
                    option.legend.data = [];
                    option.legend.data = echartsData.legendData;
                    option.xAxis[0].data = [];
                    option.xAxis[0].data = echartsData.xAxisData;
                    option.series = [];
                    for (var i = 0; i < echartsData.seriesDatas.length; i++) {
                        var color = '';
                        if (echartsData.legendData[i] == "颜色1") color = "#000068";
                        if (echartsData.legendData[i] == "颜色2") color = "#0000A0";
                        if (echartsData.legendData[i] == "颜色3") color = "#0060EE";
                        if (echartsData.legendData[i] == "颜色4") color = "#1976FF";
                        if (echartsData.legendData[i] == "颜色5") color = "#69B4FF";
                        if (echartsData.legendData[i] == "颜色6") color = "#8FAAFF";
                        option.series.push({
                            name: echartsData.legendData[i],
                            type: 'bar',
                            stack: "总量",
                            barMaxWidth: 30,
                            itemStyle: { normal: { "color": color } },
                            data: echartsData.seriesDatas[i]
                        });
                    }
                    myChart.clear();
                    myChart.setOption(option);
                }

                //grid表格数据
                if ($("#pqGrid").length > 0) {
                    var colM =[{halign:"center",align:'center', dataIndx: 'color', title: '', width: 150, editable: false, sortable: true}];
                    for (var i=0; i<outTrxObj.dynamicColumn.length; i++){
                        var line = outTrxObj.dynamicColumn[i];
                        colM.push({halign:'center', align:'center', dataIndx: line, title: line, width: 150, editable: false, sortable: true});
                    }
                    _pqUtil.f.setColModel($("#pqGrid"), colM);
                    _pqUtil.f.seTitle($("#pqGrid"), "halm机测试 - 颜色比例表格");
                    _pqUtil.f.isShowTitle($("#pqGrid"), false);
                    _pqUtil.f.loadPqGridData($("#pqGrid"), outTrxObj.dynamicColumnJsonGridData);
                }
            }
        });

    });
</script>
